package com.future.hedongjun.home.adapter;

import android.widget.ImageView;

import com.chad.library.adapter.base.BaseSectionQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.future.baselib.utils.GlideUtils;
import com.future.hedongjun.R;
import com.future.hedongjun.common.PriceHelper;
import com.future.hedongjun.home.bean.ThemeBean;

import java.util.List;

/**
 * @author jniu
 * @Email niuxiaoqi@hztianque.com
 * @time 2018/12/4
 */
public class ZhuantiAdapter extends BaseSectionQuickAdapter<ThemeBean,BaseViewHolder> {
    /**
     * Same as QuickAdapter#QuickAdapter(Context,int) but with
     * some initialization data.
     *
     * @param data             A new list is created out of this one to avoid mutable list
     */
    public ZhuantiAdapter(List<ThemeBean> data) {
        super(R.layout.recycler_item_topic, R.layout.recycler_item_head_topic, data);
    }

    @Override
    protected void convertHead(BaseViewHolder helper, ThemeBean item) {
        helper.setText(R.id.item_tv_title,item.header);
    }

    @Override
    protected void convert(BaseViewHolder helper, ThemeBean item) {
        GlideUtils.loadTopRoundImage(mContext, item.t.getMain_img(), (ImageView) helper.getView(R.id.iv_icon));
        helper.setText(R.id.tv_title, item.t.getCourse_name());
        helper.setText(R.id.tv_price, PriceHelper.priceFormat(item.t.getPrice()));
    }
}
